package com.dc.docs._888_面试.concurrent._3_collection;

import cn.hutool.core.lang.UUID;
import com.google.common.collect.Maps;

import java.util.HashMap;

/**
 * Description: 集合类不安全问题_HashMap
 * @author: gdc
 * @date: 2021/6/15
 * @version 1.0
 */
public class HashMapNotSafeDemo {
    public static void main(String[] args){
        HashMap<String, String> map = Maps.newHashMap();
        for (int i = 0; i < 30; i++) {
            new Thread(() -> {
                map.put(Thread.currentThread().getName(), UUID.fastUUID().toString());

                System.out.println(map);
            }, String.valueOf(i)).start();

        }
    }
}
